package com.portal.sso.ldap.service;

import com.portal.sso.core.server.PortalUserServer;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.autoconfigure.condition.ConditionalOnClass;
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

@Configuration
@EnableConfigurationProperties({PortalSsoLdapProperties.class})
public class PortalSsoLdapAutoConfiguration {
    @Autowired
    PortalSsoLdapProperties portalSsoLdapProperties;
    @Bean
    @ConditionalOnMissingBean(PortalUserServer.class)
    @ConditionalOnClass(PortalUserServer.class)
    public PortalUserServer portalSsoJdbcServer(){
        PortalUserServer portalSsoLdapServer = new PortalSsoLdapServer(portalSsoLdapProperties);
        return portalSsoLdapServer;
    }
}
